package com.haha.project0301.dao;

import com.haha.project0301.pojo.Department;
import org.springframework.stereotype.Component;

import java.util.Collection;
import java.util.HashMap;
import java.util.Map;

/**
 * @author dsx
 * @date 2021/3/1 16:43
 * @since JDK1.8
 */
@Component
public class DepartmentDao {
    private static Map<Integer, Department> departmentMap = null;
    
    static {
        departmentMap = new HashMap<>();
        departmentMap.put(1,new Department(1,"hr"));
        departmentMap.put(2,new Department(2,"不会css的前端"));
        departmentMap.put(3,new Department(3,"苦逼的敲代码"));
        departmentMap.put(4,new Department(4,"经理"));
        departmentMap.put(5,new Department(5,"准备删库的架构"));
    }
    
    public Collection<Department> getAllDepartment(){
        return departmentMap.values();
    }
    
    public Department getDepartmentById(Integer id){
        return departmentMap.get(id);
    }
}
